package com.mxl.rabbitmq.consumer;

import com.alibaba.fastjson.JSON;
import com.mxl.rabbitmq.config.FanoutConfig;
import com.mxl.rabbitmq.model.MessageBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

//@Component
@Slf4j
public class FanoutReceiver {

    @RabbitListener(queues = FanoutConfig.QUEUE_NAME_FANOUT)
    public void prccess(MessageBody messageBody){
      log.info("Fanout-消费者得到的消息内容: {}", JSON.toJSONString(messageBody));
    }

    @RabbitListener(queues = FanoutConfig.QUEUE_NAME_FANOUT2)
    public void prccess2(MessageBody messageBody){
        log.info("Fanout2-消费者得到的消息内容: {}", JSON.toJSONString(messageBody));
    }
}
